package com.cmsky.open.shop.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import com.cmsky.open.core.base.*;
import com.cmsky.open.core.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.cmsky.open.security.model.RolesInfo;
import com.cmsky.open.shop.model.*;
import com.cmsky.open.shop.dao.*;
import com.cmsky.open.shop.manager.*;
import com.cmsky.open.shop.vo.query.*;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


public class ShopInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "ShopInfo";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_NAME = "商户名";
	public static final String ALIAS_MASTER_NAME = "店主姓名";
	public static final String ALIAS_MASTER_CARD = "店主身份证";
	public static final String ALIAS_EMAIL = "邮箱(帐号)";
	public static final String ALIAS_PHONE = "商户电话";
	public static final String ALIAS_ADDRESS = "地址";
	public static final String ALIAS_REGISTER_TIME = "注册时间";
	public static final String ALIAS_STATE = "状态";
	public static final String ALIAS_PASSWD = "密码";
	public static final String ALIAS_ROLE_ID = "角色";
	
	//date formats
	public static final String FORMAT_REGISTER_TIME = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 编号       db_column: id 
     */	
	
	private java.lang.Integer id;
    /**
     * 商户名       db_column: name 
     */	
	@NotBlank @Length(max=50)
	private java.lang.String name;
    /**
     * 店主姓名       db_column: master_name 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String masterName;
    /**
     * 店主身份证       db_column: master_card 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String masterCard;
    /**
     * 邮箱(帐号)       db_column: email 
     */	
	@NotBlank @Email @Length(max=50)
	private java.lang.String email;
    /**
     * 商户电话       db_column: phone 
     */	
	@NotBlank @Length(max=50)
	private java.lang.String phone;
    /**
     * 地址       db_column: address 
     */	
	@NotBlank @Length(max=200)
	private java.lang.String address;
    /**
     * 注册时间       db_column: register_time 
     */	
	@NotNull 
	private java.util.Date registerTime;
    /**
     * 状态       db_column: state 
     */	
	@NotNull @Max(127)
	private Integer state;
    /**
     * 密码       db_column: passwd 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String passwd;
    /**
     * 角色       db_column: roleId 
     */	
	
	private java.lang.Integer roleId;
	//columns END

	public ShopInfo(){
	}

	public ShopInfo(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setMasterName(java.lang.String value) {
		this.masterName = value;
	}
	
	public java.lang.String getMasterName() {
		return this.masterName;
	}
	public void setMasterCard(java.lang.String value) {
		this.masterCard = value;
	}
	
	public java.lang.String getMasterCard() {
		return this.masterCard;
	}
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	public java.lang.String getEmail() {
		return this.email;
	}
	public void setPhone(java.lang.String value) {
		this.phone = value;
	}
	
	public java.lang.String getPhone() {
		return this.phone;
	}
	public void setAddress(java.lang.String value) {
		this.address = value;
	}
	
	public java.lang.String getAddress() {
		return this.address;
	}
	public String getRegisterTimeString() {
		return DateConvertUtils.format(getRegisterTime(), FORMAT_REGISTER_TIME);
	}
	public void setRegisterTimeString(String value) {
		setRegisterTime(DateConvertUtils.parse(value, FORMAT_REGISTER_TIME,java.util.Date.class));
	}
	
	public void setRegisterTime(java.util.Date value) {
		this.registerTime = value;
	}
	
	public java.util.Date getRegisterTime() {
		return this.registerTime;
	}
	public void setState(Integer value) {
		this.state = value;
	}
	
	public Integer getState() {
		return this.state;
	}
	public void setPasswd(java.lang.String value) {
		this.passwd = value;
	}
	
	public java.lang.String getPasswd() {
		return this.passwd;
	}
	public void setRoleId(java.lang.Integer value) {
		this.roleId = value;
	}
	
	public java.lang.Integer getRoleId() {
		return this.roleId;
	}
	
	private RolesInfo rolesInfo;
	
	public void setRolesInfo(RolesInfo rolesInfo){
		this.rolesInfo = rolesInfo;
	}
	
	public RolesInfo getRolesInfo() {
		return rolesInfo;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Name",getName())
			.append("MasterName",getMasterName())
			.append("MasterCard",getMasterCard())
			.append("Email",getEmail())
			.append("Phone",getPhone())
			.append("Address",getAddress())
			.append("RegisterTime",getRegisterTime())
			.append("State",getState())
			.append("Passwd",getPasswd())
			.append("RoleId",getRoleId())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof ShopInfo == false) return false;
		if(this == obj) return true;
		ShopInfo other = (ShopInfo)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getName(),other.getName())
			.append(getMasterName(),other.getMasterName())
			.append(getMasterCard(),other.getMasterCard())
			.append(getEmail(),other.getEmail())
			.append(getPhone(),other.getPhone())
			.append(getAddress(),other.getAddress())
			.append(getRegisterTime(),other.getRegisterTime())
			.append(getState(),other.getState())
			.append(getPasswd(),other.getPasswd())
			.append(getRoleId(),other.getRoleId())
			.isEquals();
	}
}

